$("#testAdd").validate({
    rules:{
        phone:{required:true,mobile:true},
        password:{required:true}
    }
})
var testList;
$(function(){
	//渲染加载表格
	if($("#testList").length>0){
        testList = $.fn.bsgrid.init('testList', {
            url:'List.php',               //数据地址
            pageSizeSelect: true,
            pageSize: 10,
            stripeRows: true,
            displayBlankRows: false
        });
    }
})

//user表格相关方法
var user={
    //认证标识
    authentication:function(record, rowIndex, colIndex, options){
        var authentication=testList.getRecordIndexValue(record, 'authentication');
        var id=testList.getRecordIndexValue(record, 'id');
        if(authentication==1) return '<a href="userAuthDetails.html?id=' + id + '" class="sui-text-success">已认证（查看）</a>';
        else if(authentication==0) return '<span class="sui-text-disabled">未认证</span>';
    },
    //表格操作
    operate:function(record, rowIndex, colIndex, options) {
        var id=testList.getRecordIndexValue(record, 'id');
        var operate='<a href="testEdit.php?id=' + id + '">编辑</a> '+
                    '<a href="userMoney.html?id=' + id + '">现金</a> '+
                    '<a href="javascript:;" onclick="user.del(' + id + ')">删除</a> ';
        return operate;
    },
    //搜索
    search:function(){
        var form=$("#seach").serializeArray();
        testList.search(form);
    },
    //删除单个账号
    del:function(id){
        table.del({
            "id":id,
            "url":'del.php'
        })
    },
    //删除勾选账号
    delCheck:function(){
        var ids = testList.getCheckedValues("id");
        table.delCheck({
            "ids":ids,
            "url":'dels.php'
        })   
    }
}